/* ******************************************************************
 * This file is part of the escal project and distributed under the
 * terms of the GNU General Public License Version 3
 * Copyright (C) 2008 Epocher (xijiaosdq@gmail.com)
 * See COPYING file for licensing information.
 *******************************************************************/

#ifndef ESCAL_SETTINGS_H
#define ESCAL_SETTINGS_H
#include <QSettings>
class EscalSettings:public QObject {
	Q_OBJECT
public:
	EscalSettings(const QString & organization, const QString 
		& application = QString(), QObject * parent = 0 );
	EscalSettings(const QString & fileName, QSettings::Format format,
		QObject * parent = 0 );
	QVariant value ( const QString & key, const QVariant 
			& defaultValue = QVariant() ) const;
	QVariant defaultValue(const QString & key) const;
	void setValue ( const QString & key, const QVariant & value );
	QString fileName () const { return settings.fileName(); };
	void sync () { settings.sync(); };
signals:
	void foldersChanged();
private:
	void buildDefaultValues();
	void checkSettings();
	QSettings settings;
	QMap<QString, QVariant> defaultMap;
};


#endif /* ESCAL_SETTINGS_H */
